home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Sample Code / Snippets / Printing / PicCommentsTest / PicComments.p < prev    next >
Encoding:
Text File  |  1992-07-09  |  3.8 KB  |  140 lines  |  [TEXT/PJMM]

  1. unit PicComments; { 5/9/92 - 7/9/92: fixed TDashedLineRec }
  2.  
  3. interface
  4.  
  5.     const
  6.         TextBegin = 150;
  7.         TextEnd = 151;
  8.         StringBegin = 152;
  9.         StringEnd = 153;
  10.         TextCenter = 154;
  11.         LineLayoutOff = 155;
  12.         LineLayoutOn = 156;
  13.         ClientLineLayout = 157;
  14.         PolyBegin = 160;
  15.         PolyEnd = 161;
  16.         PolyIgnore = 163;
  17.         PolySmooth = 164;
  18.         PolyClose = 165;
  19.         DashedLine = 180;
  20.         DashedStop = 181;
  21.         SetLineWidth = 182;
  22.         PostScriptBegin = 190;
  23.         PostScriptEnd = 191;
  24.         PostScriptHandle = 192;
  25.         PostScriptFile = 193;
  26.         TextIsPostScript = 194;
  27.         ResourcePS = 195;
  28.         PSBeginNoSave = 196;
  29.         SetGrayLevel = 197;
  30.         RotateBegin = 200;
  31.         RotateEnd = 201;
  32.         RotateCenter = 202;
  33.         FormsPrinting = 210;
  34.         EndFormsPrinting = 211;
  35.  
  36.    { Values for the tJus field of the TTxtPicRec record }
  37.         tJusNone = 0;
  38.         tJusLeft = 1;
  39.         tJusCenter = 2;
  40.         tJusRight = 3;
  41.         tJusFull = 4;
  42.  
  43.    { Values for the tFlip field of the TTxtPicRec record }
  44.         tFlipNone = 0;
  45.         tFlipHorizontal = 1;
  46.         tFlipVertical = 2;
  47.  
  48.         magicPen = 23; { the infamous penMode - hides drawing from QuickDraw devices }
  49.  
  50.     type
  51.         TTxtPicHdl = ^TTxtPicPtr;
  52.         TTxtPicPtr = ^TTxtPicRec;
  53.         TTxtPicRec = packed record
  54.                 tJus: Byte;
  55.                 tFlip: Byte;
  56.                 tAngle: Integer;  {clockwise rotation in degrees 0..360 }
  57.                 tLine: Byte;    {Unused/Ignored }
  58.                 tCmnt: Byte;    {Reserved }
  59.                 tAngleFixed: Fixed; { the same as "angle" in Fixed precision   }
  60.             end; { TTxtPicRec }
  61.  
  62.         TRotationHdl = ^TRotationPtr;
  63.         TRotationPtr = ^TRotationRec;
  64.         TRotationRec = record
  65.                 rFlip: Integer;
  66.                 rAngle: Integer;    { Clockwise rotation in degrees (0..360) }
  67.                 rAngleFixed: Fixed; { the same as "angle" in Fixed precision  }
  68.             end; { TRotation }
  69.  
  70.         TCenterHdl = ^TCenterPtr;
  71.         TCenterPtr = ^TCenterRec;
  72.         TCenterRec = record  {offset from current pen location to center of rotation}
  73.                 y: Fixed;
  74.                 x: Fixed;
  75.             end; { TCenter }
  76.  
  77.  
  78.         TPolyVerbHdl = ^TPolyVerbPtr;
  79.         TPolyVerbPtr = ^TPolyVerbRec;
  80.         TPolyVerbRec = packed record
  81.                 f7, f6, f5, f4, f3,     { Reserved }
  82.                 fPolyClose,          { TRUE = Polygon should be closed }
  83.                 fPolyFill,           { TRUE = Polygon should be filled }
  84.                 fPolyFrame: BOOLEAN; { TRUE = Polygon should be framed }
  85.             end;
  86.  
  87.         TDashedLineHdl = ^TDashedLinePtr;
  88.         TDashedLinePtr = ^TDashedLineRec;
  89.         TDashedLineRec = packed record
  90.                 offset: SignedByte;  { Offset into pattern for first dash }
  91.                 centered: SignedByte;  { (Ignored) }
  92.                 intervals: array[0..5] of SignedByte; { Array of dash intervals; }
  93.                           { intervals[0] contains the number of intervals }
  94.             end;
  95.  
  96.         TLineWidthHdl = ^TLineWidthPtr;
  97.         TLineWidthPtr = ^TLineWidth;
  98.         TLineWidth = Point;  { v = numerator, h = denominator }
  99.  
  100.         TClientLLHdl = ^TClientLLPtr;  { used in the ClientLineLayout picture comment }
  101.         TClientLLPtr = ^TClientLLRec;
  102.         TClientLLRec = record
  103.                 chCount: Integer;  { Apply for so many characters. }
  104.                 major: Fixed;    { Percentage of line layout error to be }
  105.                                          { distributed among space characters.   }
  106.                 spcChar: Integer;  { Code of character that is to absorb   }
  107.                                          { the "major" line layout error.        }
  108.                 minor: Fixed;    { Percentage of intercharacter distrib. }
  109.                 ulLength: Fixed;    { Underline length.                     }
  110.             end;
  111.  
  112.  
  113. {---------------------------------------------------}
  114. { -- Definitions for obsolete picture comments deleted. -- }
  115. {---------------------------------------------------}
  116.  
  117.     procedure FlushGrafPortState;
  118.     procedure FlushPostScriptState;
  119.  
  120.  
  121. implementation
  122.  
  123.     procedure FlushGrafPortState;
  124.         var
  125.             penInfo: PenState;
  126.     begin
  127.         GetPenState(penInfo);
  128.         PenSize(0, 0);
  129.         Line(0, 0);
  130.         PenSize(penInfo.pnSize.h, penInfo.pnSize.v);
  131.     end;
  132.  
  133.     procedure FlushPostScriptState;
  134.     begin
  135.         PicComment(PostScriptBegin, 0, nil);
  136.         PicComment(PostScriptEnd, 0, nil);
  137.     end;
  138.  
  139.  
  140. end.